;
var member_login_ops = {
    init: function () {
        this.eventBind();
    },
    eventBind: function () {
        $(".update_warp .do_update").click(function () {
            var btn_target = $(this);
            if (btn_target.hasClass("disabled")) {
                alert("正在处理请不要重复点击");
                return;
            }
            var new_nickname = $(".update_warp input[name=new_nickname]").val();
            if (new_nickname == undefined || new_nickname.length < 1) {
                common_ops.alert("新昵称错误");
                return;
            }

            $.ajax({
                url: common_ops.buildUrl("/member/update"),
                type: "POST",
                data: {
                    new_nickname: new_nickname
                },
                dataType: "json",
                success: function (res) {
                    btn_target.removeClass("disabled");
                    var callback = null;
                    if (res.code == 200) {
                        callback = function () {
                            window.location.href = common_ops.buildUrl("/");
                        }

                    }
                    common_ops.alert(res.msg, callback);
                }
            })
        });
    }

}
$(document).ready(function () {
    member_login_ops.init();
});